#define webpaginate(currentPage, totalPage, link)
#if(totalPage <= 0 || currentPage > totalPage) #return #end
#setLocal(startPage = currentPage - 4)
#if (startPage < 1) #setLocal(startPage = 1) #end

#setLocal(endPage = currentPage + 4)
#if (endPage > totalPage) #setLocal(endPage = totalPage) #end
    <div class="M-box">
        #if (currentPage <= 8)
            #setLocal(startPage = 1)
        #end
        #if ((totalPage - currentPage) < 8)
            #setLocal(endPage = totalPage)
        #end

        #if (currentPage == 1)
            <a href="javascript:;" class="prev">上一页</a>
        #else
            <a href="#(link)#(currentPage - 1)#(append)" class="prev">上一页</a>
        #end

        #if (currentPage > 8)
            <a href="#(link)#(1)#(append)">#(1)</a>
            <a href="#(link)#(2)#(append)">#(2)</a>
            <span>...</span>
        #end

        #for(i : [startPage..endPage])
            #if (currentPage == i)
                <span class="active">#(i)</span>
            #else
                <a href="#(link)#(i)#(append)">#(i)</a>
            #end
        #end

        #if ((totalPage - currentPage) >= 8)
            <span>...</span>
            <a href="#(link)#(totalPage - 1)#(append)">#(totalPage - 1)</a>
            <a href="#(link)#(totalPage)#(append)">#(totalPage)</a>
        #end

        #if (currentPage == totalPage)
            <a href="javascript:;" class="next">下一页</a>
        #else
            <a href="#(link)#(currentPage + 1)#(append)" class="next">下一页</a>
            <li><a href="#(link)#(currentPage + 1)#(append)" rel="next">»</a></li>
        #end
    </div>
#end